package cn.tedu.controller;

import cn.tedu.service.UserSerivce;
import cn.tedu.vo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * <pre>
 *
 * </pre>
 *
 * @author restyhap
 * @since 2019-11-22 17:56
 */
@Controller
@RequestMapping("/user")
public class UserController {


    @Autowired
    @Qualifier("userServiceImpl")
    public UserSerivce serivce;



    @RequestMapping("/findAll")
    public String findAll(ModelMap map){
        System.out.println("实现调用UserServiceImpl来调用方法.");
        List<User> list = serivce.findAll();
        map.addAttribute("userlist",list);
        return "list";
    }
    // test  ===   user/testAction
    @RequestMapping("/testAction")
    public void testAction(){
        System.out.println("请求可以到后台让Controller来处理请求");
    }

}
